package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by xin on 2015/1/17 0017.
 */
@RestController
@SpringBootApplication
public class SampleController {

    @RequestMapping("/")
    String home() {
        return "Hello World";
    }

    public static void main(String[] args) {
        // 1.
        ConfigurableApplicationContext ctx = SpringApplication.run(SampleController.class, args);
        MyBean bean = ctx.getBean("myBean", MyBean.class);
        bean.sayHello();

//        SpringApplication.setAddCommandLineProperties(false);

        // 2.
//        SpringApplication app = new SpringApplication(SampleController.class);
//        app.setShowBanner(false); // 设置不显示标语
//        app.run(args);

        // 3.
//        new SpringApplicationBuilder()
//                .showBanner(false)
//                .sources(Parent.class)
//                .child(Application.class)
//                .run(args);

    }
}
